package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.bainaeco.framework.util.AssertUtil;
import com.junzhiit.nengji.cms.service.PayHistoryService;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.PayHistoryVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/pay/history")
public class PayHistoryController extends BaseController {

	@Autowired
	private PayHistoryService payHistoryService;
	
	@ApiOperation(value = "获取消费记录")
	@RequestMapping(method = RequestMethod.GET)
	public Map<String, Object> queryPayHistory(DataTablesParamVO dtp,PayHistoryVO payHistoryVO){
		return payHistoryService.queryPayHistory(dtp,payHistoryVO);
	}
	
	@ApiOperation(value = "获取消费排行")
	@RequestMapping(value="/ranking",method = RequestMethod.GET)
	public Map<String, Object> queryPayRanking(DataTablesParamVO dtp,PayHistoryVO payHistoryVO){
		return payHistoryService.queryPayRanking(dtp,payHistoryVO);
	}
	
	@ApiOperation(value = "根据用户id查询该用户消费记录")
	@RequestMapping(value="/get",method = RequestMethod.GET)
	public Map<String, Object> queryUserPayHistory(DataTablesParamVO dtp,String sessionId,String userId){
		AssertUtil.notNull(userId, "userId is required");
		return payHistoryService.queryUserPayHistory(dtp,sessionId,userId);
	}
	
}
